<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
  $('#selectall').click(function(){
    var v = $(this).attr('checked');
    if( v == 'checked' ) {
      $('.select').attr('checked','checked');
    } else {
      $('.select').removeAttr('checked');
    }
  });
  $('.select').click(function(){
    $('#selectall').removeAttr('checked');
  });
  $('#toggle_filter').click(function(){
    $('#filter_form').toggle();
  });
  {if isset($tablesorter)}
  if( typeof($.tablesorter) != 'undefined' ) $('#articlelist').tablesorter({ sortList:{$tablesorter} });
  {/if}
});
//]]>
</script>

{if isset($formstart) }
<fieldset id="filter_form" style="display: none;">
  <legend>{$filtertext}</legend>
  {$formstart}
  <div class="pageoverflow">
    <p class="pagetext">{$mod->lang('category')}:</p>
    <p class="pageinput">
      <select name="{$actionid}categories[]" multiple="multiple" size="5">
        {html_options options=$categorylist selected=$sel_categories}
      </select>
    </p>
  </div>
  <div class="pageoverflow">
    <p class="pagetext">{$prompt_sorting}:</p>
    <p class="pageinput">{$input_sorting}</p>
  </div>
  <div class="pageoverflow">
    <p class="pagetext">{$prompt_pagelimit}:</p>
    <p class="pageinput">{$input_pagelimit}</p>
  </div>
  <div class="pageoverflow">
    <p class="pagetext">&nbsp;</p>
    <p class="pageinput">{$submitfilter}{$hidden|default:''}</p>
  </div>
  {$formend}
</fieldset>
{/if}

{if $itemcount > 0}
<div class="pageoptions">
        <input type="checkbox" id="toggle_filter" value="0"><label for="toggle_filter">{$mod->Lang('toggle_filter')}</label>
	&nbsp;{$addlink}
</div>

{if $pagecount > 1}
  <p>
{if $pagenumber > 1}
{$firstpage}&nbsp;{$prevpage}&nbsp;
{/if}
{$pagenumber}&nbsp;{$oftext}&nbsp;{$pagecount}
{if $pagenumber < $pagecount}
&nbsp;{$nextpage}&nbsp;{$lastpage}
{/if}
</p>
{/if}

{$form2start}
<table id="articlelist" cellspacing="0" class="pagetable cms_sortable tablesorter">
	<thead>
		<tr>
			<th>{$titletext}</th>
			<th>{$authortext}</th>
			<th>{$mod->Lang('url')}</th>
			<th>{$postdatetext}</th>
                        <th>{$startdatetext}</th>
                        <th>{$enddatetext}</th>
			<th class="header { sorter: false }" style="padding-left: 0;">{$statustext}</th>
			{if isset($have_blaster)}<th class="pageicon {literal}{sorter: false}{/literal}">&nbsp;</th>{/if}
			<th class="pageicon {literal}{sorter: false}{/literal}">&nbsp;</th>
			<th class="pageicon {literal}{sorter: false}{/literal}">&nbsp;</th>
			<th class="pageicon {literal}{sorter: false}{/literal}"><input type="checkbox" id="selectall" name="selectall"/></th>
		</tr>
	</thead>
	<tbody>
	{foreach from=$items item=entry}
		<tr class="{$entry->rowclass}">
			<td>{$entry->title}</td>
			<td>{$entry->author}</td>
			<td>{$entry->url}</td>
			<td>{$entry->u_postdate|cms_date_format}</td>
                        <td>{if !empty($entry->u_enddate)}{$entry->u_startdate|cms_date_format}{/if}</td>
                        <td>{if $entry->expired == 1}
                              <div class="important">
                              {$entry->u_enddate|cms_date_format}
	                      </div>
                            {else}
                              {$entry->u_enddate|cms_date_format}
                            {/if}
                        </td>
			<td>{$entry->approve_link}</td>
	                {if isset($have_blaster)}<td>
                          {if $entry->expired != 1 && $entry->o_status == 'published'}
                            {*cgsocblaster module='CGBlog' key=$entry->id*}{eval var=$blaster_tag}
                          {/if}
                        </td>{/if}
			<td>{$entry->editlink}</td>
			<td>{$entry->deletelink}</td>
			<td><input type="checkbox" name="{$actionid}sel[]" value="{$entry->id}" class="select">
		</tr>
	{/foreach}
	</tbody>
</table>
{/if}

<div style="width: 100%;">
<div class="pageoptions" style="float: left;">
	<p class="pageoptions">{$addlink}</p>
</div>
{if $itemcount > 0}
  <div class="pageoptions" style="float: right; text-align: right;">
    {$submit_massdelete}
  </div>
{/if}
<div class="clearb"></div>
</div>
{$form2end}
